/**
 * Created by ljg on 2017/3/27.
 */
const uiTableTool=function () {
    angular.module('ui.table')
        .directive('uiTableTool', function (eventHelper) {
            return {
                restrict: 'E',
                replace: true,
                transclude: true,
                controller:function ($scope,$attrs) {
                    $scope.$on('ui.table.selectedItems',function (event,data) {
                        $scope.selectedItems=data;

                    })
                },
                scope:{},
                require:"^?uiContainer",
                template: function(el,attr){
                    return  '<div class="panel-heading table-button-panel">' +
                                '<button type="button" class="btn btn-sm btn-primary" ng-repeat="btn in btns" ng-click="btn.click(selectedItems)">{{btn.text}}</button>'+
                                '<ng-transclude></ng-transclude>'+
                            '</div>';
                },
                link : function(scope, element, attrs,ctrl) {
                    scope.btns=ctrl._getBtns();

                },
            };
        });
}
export default uiTableTool;
